From: Stefan Monnier Date: Tue, 23 Nov 2010 14:19:54 +0000 (-0500) Subject: * lisp/shell.el (shell): Use current-buffer by default if it's already X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~324^2~5561 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=d05d8795f5ea9b1e3e0c3b8010b96a29e33e1686;p=emacs.git * lisp/shell.el (shell): Use current-buffer by default if it's already a shell mode buffer and its process is dead. Suggested by . --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c82141bdcbe..29eeac44841 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,13 @@ +2010-11-23 Stefan Monnier + + * shell.el (shell): Use current-buffer by default if it's already + a shell mode buffer and its process is dead. + Suggested by . + 2010-11-23 Tassilo Horn - * mail/emacsbug.el (report-emacs-bug-query-existing-bugs): Mention - that the keywords should be comma separated. + * mail/emacsbug.el (report-emacs-bug-query-existing-bugs): + Mention that the keywords should be comma separated. 2010-11-23 Chong Yidong diff --git a/lisp/shell.el b/lisp/shell.el index 7771c0d1c4f..4288834e029 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -554,13 +554,19 @@ Otherwise, one argument `-i' is passed to the shell. (generate-new-buffer-name "*shell*")) (if (file-remote-p default-directory) ;; It must be possible to declare a local default-directory. + ;; FIXME: This can't be right: it changes the default-directory + ;; of the current-buffer rather than of the *shell* buffer. (setq default-directory (expand-file-name (read-file-name "Default directory: " default-directory default-directory t nil 'file-directory-p)))))))) (require 'ansi-color) - (setq buffer (get-buffer-create (or buffer "*shell*"))) + (setq buffer (if (or buffer (not (derived-mode-p 'shell-mode)) + (comint-check-proc (current-buffer))) + (get-buffer-create (or buffer "*shell*")) + ;; If the current buffer is a dead shell buffer, use it. + (current-buffer))) ;; Pop to buffer, so that the buffer's window will be correctly set ;; when we call comint (so that comint sets the COLUMNS env var properly). (pop-to-buffer buffer)